import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function viewCard(selectedPsn) {
    const {orgVal} = this.props;
    const allpks = this.props.table.getAllTableData('ncc60071702list').rows.map((item) => item.values.pk_psndoc.value);
    const params = {
        pk_org: orgVal.refpk,
        allPsnPk: allpks.join('_'),
        selRow: allpks.findIndex((item) => item === selectedPsn)
    };
    proFetch({
        url: '/nccloud/hrhi/psndoc/PsndocCardReptQueryAction.do',
        body: params
    }).then((res) => {
        if (res.success && res.data) {
            let location = window.location;
            location.port
                ? window.open('uclient://start/http://' + location.hostname + ':' + location.port + res.data)
                : window.open('uclient://start/http://' + location.hostname + res.data);
        }
    });
}
